%-----------------------------------------------------------------------------
\chapter{Related work}
%-----------------------------------------------------------------------------


%Hier alles citen nachsehen
%Refactoring erwähnen erklären ?


\section{Hypertext Markup Language}
"`World Wide Web (WWW) was created for the purpose of information sharing.
HyperText Mark-up Language (HTML) was created for giving semantic context to
text documents published on the WWW"` \cite[S.1]{HTML1}. It is a simple to use
markup language that "`has its roots at the European Laboratory for High-Energy
Physics (CERN) in Geneva, Switzerland, where the Web project began in 1990"`
\cite[S.2]{MarkupLanguage}. Furthermore "`The World Wide Web's markup language
has always been HTML"` \cite{HTMLW3C} with which state of the art applications
can be build nowadays.





\section{Relational databases}
Relational databases are sets of related data that is stored in user-defined
tables where it can be saved to and retrieved from using Structured Query
Language (SQL) \cite[S.1519 ff]{Darwen:2003:RD:1074100.1074766}. They were first
described by Dr. E. F. Codd at IBM in 1970 \cite{codd1970relational} and are
very common and used on a widely basis nowadays.


\subsection{Structured Query Language}
Structured Query Language (SQL) is used to work with data stored in relational
databases and to a certain extend manage relational databases. ``The SQL
language has established itself as the linqua franca database management; it
provides the basis for systems interoperability, application portability,
client/server operation, distributed database, and more, and is supported by
just about every DBMS on the market today'' \cite{sql}.


\subsection{Different relational database vendors}
There exist numerous different database implementations from different vendors,
some provided as Open Source and for free, some provided as closed source with
purchasable licenses. According to the database popularity ranking of the
website ``www.db-engines.com'' the three most popular relational databases are
Oracle, MySQL and Microsoft SQL Server \cite{differentDatabases}, as shown in
figure ~\ref{figure1}.

\begin{figure}[htbp]
    \centering
    \includegraphics [width=14cm,angle=0] {figures/1.jpg}
    \caption{Relational database popularity ranking by www.db-engines.com,
    Copyright db-engines.com}
    \label{figure1}
\end{figure}

%siehe Abbildung
%Image http://db-engines.com/en/ranking_trend


\section{Representational state transfer data interfaces}
Representational state transfer (REST) data interfaces are a not standardised
lightweight form of data interchange between different components, over a
network \cite[S.76 ff]{Fielding:2000:ASD:932295}. They are used on a regular
basis nowadays.



\section{Java}
"`The Java programming language is a general-purpose, concurrent, class-based,
object-oriented language"' \cite[S. 1]{gosling2013java}. Due to the facts that
it is interpreted during execution through the so called ``Java Virtual
Machine'' runtime environment and there exist runtime environments for all major
operating systems it is operating system independent \cite{McMillan-5910448}
\cite{Java-netcentric}. Furthermore it is one of the world most popular
programming languages worldwide currently \cite{TIOBE}.
 


\subsection{Java Annotations}
``Annotations, a form of metadata, provide data about a program that is not part
of the program itself. Annotations have no direct effect on the operation of the
code they annotate.'' \cite{OracleJavaAnnotations}. Rather they describe its
calling environment what to do with elements they annotate.




 
 
%Wort überprüfen
%Verweise etc.
\section{Different software layers}
``Layering is one of the most common techniques that software designers use to
break apart a complicated software system. \ldots When thinking of a system in
terms of layers, you imagine the principal subsystems in the software arranged
in some form of layer cake, where each layer rests on a lower layer. In this
scheme the higher layer uses various services defined by the lower layer, but
the lower layer is unaware of the higher layer. Furthermore, each layer usually
hides its lower layers from the layers above, so layer 4 uses the services of
layer 3, which uses the services of layer 2, but layer 4 is unaware of layer 2''
\cite[S.17]{fowler2002patterns}. There exist three primary layers \cite[S.19
f]{fowler2002patterns} that deal with demands the vast majority of nowadays
applications do have, as shown in figure
~\ref{figure2}.


% Siehe
% http://stackoverflow.com/questions/24588838/entities-vs-domain-models-vs-view-models

  \begin{enumerate}
    \item Presentation
    \newline
    Displaying information to the user, handling user requests, serving
    Hypertext Transfer Protocol requests etc. 
    \item Domain
    \newline
    Business specific logic and rules the system is build to deal with and
    solve. Therefore this layer is often referred to as ``Business Layer'' too.
    \item Data Source
    \newline
    Communication with any kind of databases and -stores.    
  \end{enumerate}


\begin{figure}[htbp]
    \centering
    \includegraphics [width=8cm,angle=0] {figures/threeprimarylayers.png}
    \caption{The three primary software layers with its internal dependencies}
    \label{figure2}
\end{figure}


\section{The Spring framework}
``Enterprise applications have been using the spring framework for more than a
decade. It is an open-source application framework \ldots for the Java platform.
\ldots The spring framework provides several modules for developing enterprise
applications. Spring framework modules can also be integrated with other
software components. The services provided by each module can be used at various
layers for developing enterprise applications. Applications can take advantage
of these services for developing Java-based enterprise applications. The spring
framework is very popular in the Java community and has become an integral part
of the application development for Java-based applications''
\cite[S.1]{mudunuri2013spring}.


\subsection{Spring data repositories}
``The goal of Spring Data repository abstraction is to significantly reduce the
amount of boilerplate code required to implement data access layers''
\cite{SpringData}. Therefore beside other features it provides access to
relational databases utilizing object relational mapping software.


%Überlegen Benennung
\section{Coupling of software components}
One important factor in building robust, flexible, reusable and extensible
software is how its important components are tied or coupled together. There are
two types of coupling.


\subsection{Tight coupling}
``Classes that are tightly coupled are hard to reuse in isolation, since they
depend on each other. Tight coupling leads to monolithic systems, where you
can't change or remove a class without understanding and changing many other
classes. The system becomes a dense mass that's hard to learn, port, and
maintain'' \cite[S.24 f]{gamma1994design}.


\subsection{Loose coupling}
``Loose coupling increases the probability that a class can be reused by itself
and that a system can be learned, ported, modified, and extended more easily.
Design patterns use techniques such as abstract coupling and layering to promote
loosely coupled systems'' \cite[S.24 f]{gamma1994design}.
\newline
\newline
Therefore, by its very nature relational databases dent to tight coupling.
Furthermore building software which components are loose coupled is desirable.

%Datenbanken bla bla



\section{Object relational mapping}
%Aufpassen mit Wort entity
Object relational mapping (ORM) refers to ``the process of mapping a Java object
to a database table, such that each column of the database table maps to a
single field or property within the Java object. Java objects that are used to
map against tables are referred to as entity objects \ldots Not only does ORM
programming abstract the implementation details of working directly with a
database from a developer, but it also provides a standard mechanism for
deploying applications on databases from multiple vendors `` \cite[S.369]{orm}.
%For communication with databases in general SQL is utilized. 
 
 
\subsection{Different object relational mapping software vendors}
There exist numerous different object relational mapping software
im\-ple\-men\-ta\-tions from different vendors, some provided as Open Source and
for free, some provided as closed source with purchasable licenses
\cite{differentorm}.



\section{Refactoring}
%http://refactoring.com/
``Refactoring is the process of changing a software system in such a way that it
does not alter the external behavior of the code yet improves its internal
structure. It is a disciplined way to clean up code that minimizes the chances
of introducing bugs. In essence when you refactor you are improving the design
of the code after it has been written'' \cite{fowler2012refactoring}. However,
this not only comprises changes in internal program structures that can not be
invoked from outside the program modules, but comprehensive restructuring and
renaming of program elements that act as interfaces to the outside world too.
Therefore, in the latter external programs would have to be adapted too.



\subsection{Database refactoring}
According to this ``a database refactoring is a simple change to a database
schema that improves its design while retaining both its behavioral and
informational semantics. You could refactor either structural aspects of your
database schema such as table and view definitions or functional aspects such as
stored procedures and triggers. When you refactor your database schema, not only
must you rework the schema itself, but also the external systems, such as
business applications or data extracts, which are coupled to your schema.''
\cite{ambler2006refactoring}.



\section{Unit tests}
``A unit test is a piece of code (usually a method) that invokes another piece
of code and checks the correctness of some assumptions afterward. If the
assumptions turn out to be wrong, the unit test has failed. A unit is a method
or function'' \cite[S.4]{osherove2010art}. Therefore they also can approve if
software units have changed their behaviour or not if executed unaltered after
refactoring.


%http://refactoring.com/













